import * as echarts from 'echarts'

export const tableColumn1 = [
    {
        label: '堵塞点(绿色正常 红色堵塞)',
        name: 'monp',
    },
    {
        label: '油箱编号',
        name: 'name',
    },
    {
        label: '最大点',
        name: 'maxp',
    },
]
export const tableColumn2 = [
    {
        label: '截止周期时间',
        name: 'rct',
    },

    {
        label: '周期编号',
        name: 'name',
    },
    {
        label: '起始箱',
        name: 'csb',
    },
    {
        label: '起始点',
        name: 'csp',
    },
    {
        label: '截止箱',
        name: 'ccb',
    },
    {
        label: '截止点',
        name: 'ccp',
    },
    {
        label: '设置周期时间',
        name: 'sct',
    },
]
// 当前润滑参数
export const tableColumn3 = [
    {
        label: '时间',
        name: 'time',
        width: '170',
    },
    {
        label: '润滑箱',
        name: 'lb',
    },
    {
        label: '润滑点',
        name: 'lp',
    },
    {
        label: ' 提前开泵时间',
        name: 'apst',
    },
    {
        label: '预加油时间',
        name: 'prt',
    },
    {
        label: '正在润滑次数',
        name: 'lf',
    },
    {
        label: '正在润滑油量',
        name: 'loq',
    },
]
// 手动润滑参数
export const tableColumn4 = [
    {
        label: '时间',
        name: 'time',
    },
    {
        label: '起始箱',
        name: 'msb',
    },
    {
        label: '起始点',
        name: 'msp',
    },
    {
        label: '截止箱',
        name: 'mcb',
    },

    {
        label: '截止点',
        name: 'mcp',
    },
    {
        label: '手动加油量',
        name: 'mrv',
    },

]
export const topconfig = [
    {
        name: 'system_status',
        label: '系统状态',
        dataConfig: [
            {
                name: 'mm',
                label: '手动模式',
            },
            {
                name: 'am',
                label: '自动模式',
            },
            {
                name: 'sm',
                label: '停止模式',
            },
        ],
    },
    {
        name: 'total_data',
        label: '堵塞点数量和系统参数',
        dataConfig: [
            {
                name: 'opl1',
                label: '1#油泵油位（百分比%）',
            },
            {
                name: 'opl2',
                label: '2#油泵油位（百分比%）',
            },
            {
                name: 'op',
                label: '油压（MPa）',
            },
            {
                name: 'bps',
                label: '堵塞点总数量（个）',
            },
            {
                name: 'smb',
                label: '系统最大箱（个）',
            },
        ],
    },
    {
        name: 'oil_pump_status',
        label: '油泵状态',
        dataConfig: [
            {
                name: 'oll1',
                label: '1#泵油位下限标志',
            },
            {
                name: 'olu1',
                label: '1#泵油位上限标志',
            },
            {
                name: 'oll2',
                label: '2#泵油位下限标志',
            },
            {
                name: 'olu2',
                label: '2#泵油位上限标志',
            },
            {
                name: 'lps1',
                label: '1#润滑泵状态',
            },
            {
                name: 'lps2',
                label: '2#润滑泵状态',
            },
            {
                name: 'fps',
                label: '补油泵状态',
            },
        ],
    },
    {
        name: 'interlocking_parameter',
        label: '联锁信号',
        dataConfig: [
            {
                name: 'so',
                label: '系统运行',
            },
            {
                name: 'mf',
                label: '轻故障',
            },
            {
                name: 'hf',
                label: '重故障',
            },
            {
                name: 'int1',
                label: '1#联锁',
            },
            {
                name: 'int2',
                label: '2#联锁',
            },
            {
                name: 'rb',
                label: '远程启动',
            },
        ],
    },
]
export const dialog = {
    title: '下发参数',
    labelWidth: '166px',
    config: [
        {
            name: 'manual_starting_box',
            type: 'number',
            placeholder: '手动起始箱',
            label: '手动起始箱',
            split: 2,
        },
        {
            name: 'manual_starting_point',
            type: 'number',
            placeholder: '手动起始点',
            label: '手动起始点',
            split: 2,
        },
        {
            name: 'manual_cutoff_box',
            type: 'number',
            placeholder: '手动截止箱',
            label: '手动截止箱',
            split: 2,
        },

        {
            name: 'manual_cutoff_point',
            type: 'number',
            placeholder: '手动截止点',
            label: '手动截止点',
            split: 2,
        },
        {
            name: 'manual_refueling_volume',
            type: 'number',
            placeholder: '手动加油量',
            label: '手动加油量',
            split: 2,
        },
        {
            name: 'manual_mode',
            type: 'number',
            placeholder: '设置手动模式',
            label: '设置手动模式',
            split: 2,
        },
        {
            name: 'automatic_mode',
            type: 'number',
            placeholder: '设置自动模式',
            label: '设置自动模式',
            split: 2,
        },
        {
            name: 'reset_oiling',
            type: 'number',
            placeholder: '复位打油',
            label: '复位打油',
            split: 2,
        },
        {
            name: 'manual_oiling',
            type: 'number',
            placeholder: '启动手动打油',
            label: '启动手动打油',
            split: 2,
        },
        {
            name: 'oil_replenishment_1',
            type: 'number',
            placeholder: '启动1#补油',
            label: '启动1#补油',
            split: 2,
        },
        {
            name: 'oil_replenishment_2',
            type: 'number',
            placeholder: '启动2#补油',
            label: '启动2#补油',
            split: 2,
        },
        {
            name: 'reset_oil_replenishment',
            type: 'number',
            placeholder: '复位补油',
            label: '复位补油',
            split: 2,
        },
    ],
    form: {
        manual_starting_box: 0,
        manual_starting_point: 0,
        manual_cutoff_box: 0,
        manual_cutoff_point: 0,
        manual_refueling_volume: 0,
        manual_mode: 0,
        automatic_mode: 0,
        reset_oiling: 0,
        manual_oiling: 0,
        oil_replenishment_1: 0,
        oil_replenishment_2: 0,
        reset_oil_replenishment: 0,
    },
}

export const chartOption = (seriesdata, yAxisdata) => {
    return {
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'shadow',
            },
        },
        //图表位置
        grid: {
            left: '1%',
            right: '1%',
            bottom: '3%',
            top: '3%',
            containLabel: true,
        },
        //X轴
        xAxis: {
            type: 'value',
            axisLine: {
                show: false,
            },
            axisTick: {
                show: false,
            },
            //不显示X轴刻度线和数字
            splitLine: { show: false },
            axisLabel: { show: false },
        },
        yAxis: {
            type: 'category',
            data: yAxisdata,
            //升序
            inverse: false,
            splitLine: { show: false },
            axisLine: {
                show: false,
            },
            axisTick: {
                show: false,
            },
            axisLabel: {
                textStyle: {
                    color: '#0CD9E8',
                    fontSize: 14,
                },
            },
            //key和图间距
            offset: 5,
            //key文字大小
            nameTextStyle: {
                fontSize: 5,
            },
        },
        series: [
            {
                //柱状图自动排序，排序自动让Y轴名字跟着数据动
                realtimeSort: false,
                type: 'bar',
                data: seriesdata,
                barWidth: 15,
                barGap: 0,
                smooth: false,
                valueAnimation: true,
                //Y轴数字显示部分
                label: {
                    normal: {
                        show: true,
                        position: 'insideRight',
                        valueAnimation: true,
                        offset: [0, 2],
                        textStyle: {
                            color: '#fff',
                            fontSize: 12,
                        },
                    },
                },
                itemStyle: {
                    emphasis: {
                        barBorderRadius: 10,
                    },
                    //颜色样式部分
                    normal: {
                        barBorderRadius: 7,
                        color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                            { offset: 0, color: '#3977E6' },
                            { offset: 1, color: '#37BBF8' },
                        ]),
                    },
                },
            },
        ],
    }
}

export const formConfig1 = [
    {
        name: 'start_time',
        type: 'date',
        label: '起始时间',
        placeholder: '请输入起始时间',
        required: true,
    },
    {
        name: 'end_time',
        type: 'date',
        label: '截止时间',
        placeholder: '请输入截止时间',
        required: true,
    },

]
